Skip to content

Deduplicate analysis policy config and appid SQL predicate#12

Merged
kasnder merged 1 commit into
mainfrom
claude/config-cleanup
Jul 13, 2026
Merged

Deduplicate analysis policy config and appid SQL predicate#12
kasnder merged 1 commit into
mainfrom
claude/config-cleanup

Conversation

@kasnder

@kasnder kasnder commented Jul 13, 2026

Copy link
Copy Markdown
Member

Summary

  • Extract the CURRENT_ANALYSIS_VERSION / STALE_ANALYSIS_DAYS / PROCESSING_TIMEOUT_MINUTES env parsing (defaults 4 / 180 / 120) into lib/analysisPolicy.js, and use it in models/Apps.js, scripts/priority-report.js, and scripts/queue-status.js instead of three copies of the same parsing logic.
  • Extract the appid ~ $n AND appid !~ '[.]$' AND length(appid) <= $m SQL predicate into a small appIdSqlPredicate() helper in lib/appId.js, and use it in models/Apps.js (countQueue x2, nextApp) instead of three inline copies.
  • Document that apps.analysed is stamped on failed analyses too (it's really "last attempt time" for failed rows), with a code comment in updateAnalysis (models/Apps.js) and a SQL comment next to the column in migrations/000_apps.sql.

Pure refactor plus comments — no behavior change. The scripts still call dotenv.config() before requiring lib/analysisPolicy.js, matching the existing pattern.

Test plan

  • npm test (node --test) — all 22 tests pass
  • node -c syntax check on all changed files

🤖 Generated with Claude Code

Extract the CURRENT_ANALYSIS_VERSION/STALE_ANALYSIS_DAYS/
PROCESSING_TIMEOUT_MINUTES env parsing into lib/analysisPolicy.js, and the
appid ~ pattern / length SQL predicate into lib/appId.js, so they're each
defined once instead of duplicated across models/Apps.js and the reporting
scripts. Also document that apps.analysed is stamped on failed analyses too
(it's really "last attempt time"), in a code comment and a migration comment.

Pure refactor plus comments; no behavior change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@kasnder
kasnder merged commit cf1278e into main Jul 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant